package cn.powerone.scm.service.impl;

import java.util.List;
import cn.powerone.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.powerone.scm.mapper.ScmProductsHistoryMapper;
import cn.powerone.scm.domain.ScmProductsHistory;
import cn.powerone.scm.service.IScmProductsHistoryService;

/**
 * 产品修改历史Service业务层处理
 * 
 * @author PowerOne
 * @date 2025-07-29
 */
@Service
public class ScmProductsHistoryServiceImpl implements IScmProductsHistoryService 
{
    @Autowired
    private ScmProductsHistoryMapper scmProductsHistoryMapper;

    /**
     * 查询产品修改历史
     * 
     * @param id 产品修改历史主键
     * @return 产品修改历史
     */
    @Override
    public ScmProductsHistory selectScmProductsHistoryById(Long id)
    {
        return scmProductsHistoryMapper.selectScmProductsHistoryById(id);
    }

    /**
     * 查询产品修改历史列表
     * 
     * @param scmProductsHistory 产品修改历史
     * @return 产品修改历史
     */
    @Override
    public List<ScmProductsHistory> selectScmProductsHistoryList(ScmProductsHistory scmProductsHistory)
    {
        return scmProductsHistoryMapper.selectScmProductsHistoryList(scmProductsHistory);
    }

    /**
     * 新增产品修改历史
     * 
     * @param scmProductsHistory 产品修改历史
     * @return 结果
     */
    @Override
    public int insertScmProductsHistory(ScmProductsHistory scmProductsHistory)
    {
        scmProductsHistory.setCreateTime(DateUtils.getNowDate());
        return scmProductsHistoryMapper.insertScmProductsHistory(scmProductsHistory);
    }

    /**
     * 修改产品修改历史
     * 
     * @param scmProductsHistory 产品修改历史
     * @return 结果
     */
    @Override
    public int updateScmProductsHistory(ScmProductsHistory scmProductsHistory)
    {
        scmProductsHistory.setUpdateTime(DateUtils.getNowDate());
        return scmProductsHistoryMapper.updateScmProductsHistory(scmProductsHistory);
    }

    /**
     * 批量删除产品修改历史
     * 
     * @param ids 需要删除的产品修改历史主键
     * @return 结果
     */
    @Override
    public int deleteScmProductsHistoryByIds(Long[] ids)
    {
        return scmProductsHistoryMapper.deleteScmProductsHistoryByIds(ids);
    }

    /**
     * 删除产品修改历史信息
     * 
     * @param id 产品修改历史主键
     * @return 结果
     */
    @Override
    public int deleteScmProductsHistoryById(Long id)
    {
        return scmProductsHistoryMapper.deleteScmProductsHistoryById(id);
    }

    /**
     * 根据产品id查询产品修改历史
     *
     * @param productIds 产品id
     * @return 产品修改历史
     */
    @Override
    public List<ScmProductsHistory> selectScmProductsHistoryByProductIds(Long[] productIds) {
        return scmProductsHistoryMapper.selectScmProductsHistoryByProductIds(productIds);
    }
}
